package com.yanqu.road.server.cross3server.cmd.server;

import com.yanqu.road.pb.server.LoadProto;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.command.Command;
import com.yanqu.road.server.cross3server.conn.Cross3ConnSet;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;
import io.netty.channel.ChannelHandlerContext;

@Cmd(code = Protocol.C3_CROSS_HEART_CHECK, desc = "跨域服务器心跳检测")
public class ChannelServerHeartCheckCmd implements Command {

    @Override
    public void execute(ChannelHandlerContext ctx, YanQuMessage packet) throws Exception {
        LoadProto.CheckCrossConnectMsg msg = LoadProto.CheckCrossConnectMsg.parseFrom(packet.getBytes());
        int id = 0;
        if (msg.hasId()) {
            id = msg.getId();
        }
        Cross3ConnSet.setChannelConnSetCheckTime((int) packet.getPlayerId(), msg.getServerType(), id);
    }

}
